/*
 * @Author: your name
 * @Date: 2021-09-03 11:52:40
 * @LastEditTime: 2021-09-04 11:47:54
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \maidoubuy\pages\index\index.js
 */
//封装一下wx.request;
import {request} from "../../request/index"

Page({
   data:{
       //轮播图的数组
       swiperList:[],
       //导航数组;
       cateList:[],
       //楼层的数组;
       floorList:[]
   },
   //页面开始加载就会触发
   onLoad:function(options){
     //发送异步请求;
     this.getSwiperList();
     this.getCateList();
     this.getFloorList()
   },
   //获取轮播图数据
   getSwiperList(){
       request({
           url:'/home/swiperdata'
       }).then(res=>{
           this.setData({
               swiperList:res
           })
       })
   },
   getCateList(){
       request({
           url:'/home/catitems'
       }).then(res=>{
           this.setData({
            cateList:res
           })
       })
   },
   getFloorList(){
       request({
           url:'/home/floordata'
       }).then(res=>{
           console.log(res)
           this.setData({
               floorList:res
           })
       })
   }

})